package ModelLayer;

import java.util.ArrayList;
import java.util.Date;

public class DataHolder {
	
	private static DataHolder instance;
	public static DataHolder getInstance()
	{
		if(instance == null){instance = new DataHolder();}
		return instance;
	}
	
	private DataHolder()
	{
		dateHolder = new Date();
		dueHolder = new Date();
		customerHolder = new Contact();
		employeeHolder = new Employee();
		deliveryHolder = new Delivery();
		salesLineHolder = new ArrayList<SalesLine>();
	}
	
	private Date dateHolder;
	private Date dueHolder;
	private Contact customerHolder;
	private Employee employeeHolder;
	private Delivery deliveryHolder;
	private ArrayList<SalesLine> salesLineHolder;

	
	public ArrayList<SalesLine> getSalesLineHolder() {
		return salesLineHolder;
	}

	public void setSalesLineHolder(ArrayList<SalesLine> salesLineHolder) {
		this.salesLineHolder = salesLineHolder;
	}
	
	public void addToSalesLines(SalesLine salesLine)
	{
		salesLineHolder.add(salesLine);
	}
	
	public void removeFromSalesLines(SalesLine salesLine)
	{
		salesLineHolder.remove(salesLine);
	}

	public Date getDateHolder() {
		return dateHolder;
	}

	public void setDateHolder(Date dateHolder) {
		this.dateHolder = dateHolder;
	}

	public Date getDueHolder() {
		return dueHolder;
	}

	public void setDueHolder(Date dueHolder) {
		this.dueHolder = dueHolder;
	}

	public Contact getCustomerHolder() {
		return customerHolder;
	}

	public void setCustomerHolder(Contact customerHolder) {
		this.customerHolder = customerHolder;
	}

	public Employee getEmployeeHolder() {
		return employeeHolder;
	}

	public void setEmployeeHolder(Employee employeeHolder) {
		this.employeeHolder = employeeHolder;
	}

	public Delivery getDeliveryHolder() {
		return deliveryHolder;
	}

	public void setDeliveryHolder(Delivery deliveryHolder) {
		this.deliveryHolder = deliveryHolder;
	}

	public void flushData()
	{
		dateHolder = null;
		dueHolder = null;
		customerHolder = null;
		employeeHolder = null;
		deliveryHolder = null;
		salesLineHolder.clear();
	}

//	public String toUpper(String s)
//	{
//		return s=s.substring(0,1).toUpperCase() + s.substring(1,s.length()-1);
//	}
	
	
}
